package com.ghr.exception;

import com.ghr.common.enums.ErrorCode;
import com.ghr.common.enums.ErrorDesc;

/**
 * @author Gghr
 * @version 1.0
 * @date 2023/7/19 21:28
 */
public class BusinessException extends RuntimeException {
    private final int code;
    private final String description;

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public BusinessException(int code, String message, String description) {
        super(message);
        this.code = code;
        this.description = description;
    }

    public BusinessException(ErrorCode errorCode, ErrorDesc errorDesc){
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = errorDesc.getDescription();
    }

}
